local EquipChooseCell = class("EquipChooseCell")

local CARD_NUM = 5

function EquipChooseCell:ctor()
end

function EquipChooseCell:awake()
    for i = 1, CARD_NUM do
        self["_card" .. i]:setCallback(
            function(equipId)
                self:_onTouchCard(i, equipId)
            end
        )
    end
end

function EquipChooseCell:updateUI(lines, selectedId)
    for i = 1, CARD_NUM do
        local data = lines[i]
        if data then
            self["_card" .. i].gameObject:SetActive(true)
            self["_card" .. i]:updateUI(data, selectedId)
        else
            self["_card" .. i].gameObject:SetActive(false)
        end
    end
end

function EquipChooseCell:_onTouchCard(index, equipId)
    if self.customCallback then
        self.customCallback(self, equipId)
    end
end

return EquipChooseCell
